<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.qijia.travel.common.Constants"%>
<%@page import="com.qijia.travel.app.GuideManager"%>
<%@page import="com.qijia.travel.app.AppErrorException"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setCharacterEncoding("UTF-8");

String accountName = request.getParameter("username");
String password = request.getParameter("password");


GuideManager guideManager = new GuideManager();
try{
session.setAttribute(Constants.USER_KEY,guideManager.login(accountName,password));
}catch(AppErrorException e){
   out.println("<script>alert('"+e.getMessage()+"!');window.location='"+basePath+"';</script>");
}
out.println("<script>alert('登录成功!');window.location='"+basePath+"baseInfo/home.jsp';</script>");
%>

